%{
    This file is part of StemCellQC, a video bioinformatics software
    toolkit for analysis of phase contrast microscopy videos.
    Copyright 2013-2015 Vincent On. [vincenton001-at-gmail.com]

    StemCellQC is free software: you can redistribute it and/or 
    modify it under the terms of the GNU General Public License as 
    published by the Free Software Foundation, either version 3 of the 
    License, or (at your option) any later version.

    StemCellQC is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with StemCellQC.  If not, see <http://www.gnu.org/licenses/>.
%}

% function creates 3 classifers based on training samples: SVM, K-Nearest
% Neighbors, and Naive Bayes.

function hESC_save_classifier( features , run_settings , multipler_value )
n_frames = run_settings.Mov_Avg_Int;

%removes features that won't be used in classifier
%stat values
%1 - area
%2 - perimeter
%3 - centroid x
%4 - centroid y
%5 - extent
%6 - solidity
%7 - orientation
%8 - major axis length
%9 - minor axis length
%10 - eccentricity
%11 - min radius
%12 - max radius
%13 - avg radius
%14 - avg intensity
%15 - Max intensity
%16 - min intensity
%17 - bright area ratio
%18 - # of protrusions
%19 - Ratio of protrusion area
%20 - change in area
%21 - change in perimeter
%22 - change in centroid
%23 - mean squared displacement

remove_c = 1 : length( features );
remove_c( features ) = [];


%% load data and labels
% get the directory
Load_classifier_data_labels;

%SVM
%construct classifier from data and labels
SVMStruct = svmtrain( samples , labels );

%KNN
train_samples = samples;


%NaiveBayes
nbStruct = NaiveBayes.fit( samples , labels );


uisave( { 'train_samples' , 'labels' , 'SVMStruct' , 'nbStruct' , 'remove_c' , 'n_frames' } )



